import json
import random
from ronglian_sms_sdk import SmsSDK

def send(mobile,sms_content):
    # MD5 加密 ACCOUNT_SID +  AUTH_TOKEN +  timestamp
    ACCOUNT_SID = "2c94811c92f9eb98019305e0abac027c"
    AUTH_TOKEN =  "1c19bc8f645047b7b072053d06fb48e2"
    APP_ID =      "2c94811c92f9eb98019305e0ad5a0283"


    # 短信验证码放入redis中  "手机号" : "短信验证码"
    tid = "1"
    datas = sms_content
    sms = SmsSDK(ACCOUNT_SID, AUTH_TOKEN, APP_ID)

    ok_is = sms.sendMessage(tid,mobile,datas)

    # print(type(ok_is)) # <class 'str'>
    mydict = json.loads(ok_is)  # 类型转换
    """
    Response_body: {
        "statusCode": "000000",
        "templateSMS": {
            "smsMessageSid": "00901f139cd043d3bb84d975500571dd", 
            "dateCreated": "20241225170501"
            }
        }
    """
    return mydict.get('statusCode')

# 测试
"""
if __name__ == '__main__':
    send()
"""